package org.langqiao.thread;

public class NumberRunnable implements Runnable {
	private int first;//序列的起始值
	public NumberRunnable(int first)//构造方法
	{
		this.first=first;
	}
	public NumberRunnable()//构造方法重载
	{
		this(0);
	}
	public void run()//复写Runnable接口的run()方法
	{
	    for(int i=first;i<=50;i+=2)
	    {
	    	System.out.print(i+" ");
	    }
	    System.out.println("结束！");
	}
	public static void main(String[] args)
	{
		NumberRunnable odd=new NumberRunnable(1);
		Thread thread_odd=new Thread(odd,"奇数线程");
		thread_odd.start();//奇数线程开启
		new Thread(new NumberRunnable(2),"偶数线程").start();//偶数线程开启
	}
		
}